TechNote - Colors
Sunday, February 19, 2023
12:53 PM
I'm baffled! I have no idea how OneNote maps colors when you see either a light background or a dark background using the Switch Background button on the View ribbon.
At a first glance, it seems that if the page background is dark (brightness is less than 50%) then OneNote increases the brightness of all applied colors by 25%; the L of the HSL color value is increased by 25, but not always.
In another case of Microsoft being "too smart for their own good", OneNote doesn't allow you to override those colors from the COM API. No matter what colors you apply to the XML, OneNote will increase the brightness if the page background is considering "dark". You can, however, still use OneNote's font color button and it will happily apply any color your choose.
|
Registry for Office Themes
OneNote follows the Microsoft Office theme. All Office apps are controlled by a single Registry key
Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common
The key has one of two properties based on Office version (I believe). They are Theme or UI Theme. Valid values for this property are
Colorful |
0 |
Dark Gray |
3 |
Black |
4 |
White |
5 |
Light mode vs. Dark mode
If we explore the differences between the light mode color picker and the dark mode color picker
It doesn't appear to be a straight inversion of colors. You can see the pictures below are not the same as those above.
Interrogate each color and list its RGB and HSL values
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Custom Page Colors
|
View this table in light mode!
| |||||||||||||||||||||||||||||||||
|
|
References
- https://stackoverflow.com/questions/801406/c-create-a-lighter-darker-color-based-on-a-system-color
- https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.controlpaint.light?view=netcore-3.1
- https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.controlpaint.dark?view=netframework-4.8
#omwiki #omdeveloper #omtechnote
© 2020 Steven M Cohn. All rights reserved.
Please consider a sponsorship or one-time donation to support ongoing development
Created with OneNote.